/**
 * @file TEST_list_node.c
 * @author Linquan  
 * @brief 
 * @version 1.0
 * @date 2024-06-06
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#include "app_config.h"

#if TEST_LIST_NODE 

#include "TEST_list_node.h"
#include <stdio.h>
#include "list_node.h"
#include "evtqueue.h"



EVT_T evt1=
{
    .time = 1111,
    .eEvtKind = 1
};

EVT_T evt2=
{
    .time = 2222,
    .eEvtKind = 1
};

EVT_T evt3=
{
    .time = 3333,
    .eEvtKind = 33
};

EVT_T evt4=
{
    .time = 4444,
    .eEvtKind = 44
};


EVT_T evt_get;
///////////////


list_head_node lists;
uint8_t list_buff[sizeof(EVT_T)*16 ] ;

void TEST_list_node(void * ptr)
{
    list_init_withbuf(&lists, list_buff, sizeof(list_buff));

    GREEN_PRINT("-evt num  %d \n",get_list_num(&lists));
    
    YELLOW_PRINT("evt read return  %d \n",list_read(&lists,POSI_READ, 1, &evt_get));

    list_write(&lists, TAIL_ADD, evt1);
    list_write(&lists, TAIL_ADD, evt2);
    CYAN_PRINT("--evt num  %d \n",get_list_num(&lists));

    list_read(&lists, REVER_READ, 2, &evt_get);
    B_BLUE_PRINT("evt time %d \n",evt_get.time);

    list_delete(&lists, evt1);
    list_read(&lists, REVER_READ, 1, &evt_get);
    YELLOW_PRINT("---evt num  %d \n",get_list_num(&lists));
}

EXPORT_Lv6_APP_SINGLE(TEST_list_node,NULL);

#endif
